//
//  CellDidSelectViewController.m
//  播求
//
//  Created by MS on 15-9-18.
//  Copyright (c) 2015年 gengsensen. All rights reserved.
//

#import "CellDidSelectViewController.h"
#import "RDVTabBarController.h"
@interface CellDidSelectViewController ()<UIWebViewDelegate>

@end

@implementation CellDidSelectViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    //<1>创建网页视图对象
    UIWebView * web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64)];
    web.delegate=self;
    
    //<2>获取显示网页的网址
    NSString * path = self.httpString;
    
    //<3>将字符串网址转化成NSURL
    NSURL * url = [NSURL URLWithString:path];
    
    //<4>将网址下的数据封装成请求对象
    NSURLRequest * request = [NSURLRequest requestWithURL:url];
    
    //<5>将请求下来的数据放在webView上
    [web loadRequest:request];
    
    //<6>将web添加到当前视图上
    [self.view addSubview:web];
    
    //self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:self action:@selector(backButton:)];
    
    
    

    // Do any additional setup after loading the view.
}
////-(void)backButton:(id)sender{
//
//    [self dismissViewControllerAnimated:YES completion:nil];
//}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[self rdv_tabBarController] setTabBarHidden:YES animated:YES];
    
}
-(void)viewWillDisappear:(BOOL)animated{
    
    [[self rdv_tabBarController] setTabBarHidden:NO animated:YES];
    [super viewWillDisappear:animated];
}

//开始请求时回调
- (void)webViewDidStartLoad:(UIWebView *)webView {
    
    [MMProgressHUD setPresentationStyle:MMProgressHUDPresentationStyleSwingLeft];
    [MMProgressHUD showWithTitle:@"Loading" status:@"  "];
    
}
//请求成功时回调
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    [MMProgressHUD dismissWithSuccess:@"Success!"];
}
//请求失败时回调
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    
    
    [MMProgressHUD dismissWithError:@"Success!"];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
